#include <unordered_map>
#include <vector>
class Solution {
public:
    bool hash[1001] = { 0 };

    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {
        vector<int> ret;

        for (auto x : nums1)
        {
            hash[x] = true;
        }

        for (auto x : nums2)
        {
            if (hash[x] == true)
            {
                ret.push_back(x);
                hash[x] = false;
            }
        }

        return ret;
    }
};